.class Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;
.super Landroid/os/AsyncTask;
.source "CategoryListActivity.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/opongo/blogapp/activities/CategoryListActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "downloadNewPostsAsyncTask"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/os/AsyncTask",
        "<",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        "Ljava/lang/Void;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;


# direct methods
.method private constructor <init>(Lcom/opongo/blogapp/activities/CategoryListActivity;)V
    .locals 0
    .parameter

    .prologue
    .line 164
    iput-object p1, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/opongo/blogapp/activities/CategoryListActivity;Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 164
    invoke-direct {p0, p1}, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;-><init>(Lcom/opongo/blogapp/activities/CategoryListActivity;)V

    return-void
.end method


# virtual methods
.method protected bridge varargs synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    check-cast p1, [Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/Void;

    move-result-object v0

    return-object v0
.end method

.method protected varargs doInBackground([Ljava/lang/Void;)Ljava/lang/Void;
    .locals 3
    .parameter "params"

    .prologue
    .line 169
    const/4 v0, 0x0

    .line 171
    .local v0, cats:Lorg/json/JSONArray;
    :try_start_0
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    #getter for: Lcom/opongo/blogapp/activities/CategoryListActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;
    invoke-static {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$0(Lcom/opongo/blogapp/activities/CategoryListActivity;)Lcom/opongo/blogapp/manager/APIManager;

    move-result-object v2

    invoke-virtual {v2}, Lcom/opongo/blogapp/manager/APIManager;->getCategories()Lorg/json/JSONArray;

    move-result-object v0

    .line 172
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    #getter for: Lcom/opongo/blogapp/activities/CategoryListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;
    invoke-static {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$1(Lcom/opongo/blogapp/activities/CategoryListActivity;)Lcom/opongo/blogapp/manager/DatabaseManager;

    move-result-object v2

    invoke-virtual {v2, v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->insertCats(Lorg/json/JSONArray;)Z
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 178
    :goto_0
    const/4 v2, 0x0

    return-object v2

    .line 173
    :catch_0
    move-exception v1

    .line 175
    .local v1, e:Lorg/json/JSONException;
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_0
.end method

.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
    .locals 0
    .parameter

    .prologue
    .line 1
    check-cast p1, Ljava/lang/Void;

    invoke-virtual {p0, p1}, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->onPostExecute(Ljava/lang/Void;)V

    return-void
.end method

.method protected onPostExecute(Ljava/lang/Void;)V
    .locals 6
    .parameter "v"

    .prologue
    const/4 v5, 0x1

    const/4 v4, 0x0

    .line 183
    sget-boolean v2, Lcom/opongo/blogapp/activities/CategoryListActivity;->DEBUG:Z

    if-eqz v2, :cond_0

    .line 184
    invoke-static {}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$2()Ljava/lang/String;

    move-result-object v2

    const-string v3, "onPostExecute"

    invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 185
    :cond_0
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    #getter for: Lcom/opongo/blogapp/activities/CategoryListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CategoryPostListAdapter;
    invoke-static {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$3(Lcom/opongo/blogapp/activities/CategoryListActivity;)Lcom/opongo/blogapp/adapter/CategoryPostListAdapter;

    move-result-object v2

    invoke-virtual {v2}, Lcom/opongo/blogapp/adapter/CategoryPostListAdapter;->getCursor()Landroid/database/Cursor;

    move-result-object v2

    invoke-interface {v2}, Landroid/database/Cursor;->requery()Z

    .line 187
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    #getter for: Lcom/opongo/blogapp/activities/CategoryListActivity;->settings:Landroid/content/SharedPreferences;
    invoke-static {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$4(Lcom/opongo/blogapp/activities/CategoryListActivity;)Landroid/content/SharedPreferences;

    move-result-object v2

    const-string v3, "cat_show_message"

    invoke-interface {v2, v3, v5}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v0

    .line 189
    .local v0, showMessage:Z
    if-eqz v0, :cond_1

    .line 190
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    #getter for: Lcom/opongo/blogapp/activities/CategoryListActivity;->editor:Landroid/content/SharedPreferences$Editor;
    invoke-static {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$5(Lcom/opongo/blogapp/activities/CategoryListActivity;)Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    const-string v3, "cat_show_message"

    invoke-interface {v2, v3, v4}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    .line 191
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    #getter for: Lcom/opongo/blogapp/activities/CategoryListActivity;->editor:Landroid/content/SharedPreferences$Editor;
    invoke-static {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->access$5(Lcom/opongo/blogapp/activities/CategoryListActivity;)Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    invoke-interface {v2}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 192
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CategoryListActivity$downloadNewPostsAsyncTask;->this$0:Lcom/opongo/blogapp/activities/CategoryListActivity;

    invoke-virtual {v2}, Lcom/opongo/blogapp/activities/CategoryListActivity;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    .line 193
    const-string v3, "Hier kannst du ausw\u00e4hlen welche Kategorien angezeigt und gepusht werden sollen."

    .line 192
    invoke-static {v2, v3, v5}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v1

    .line 194
    .local v1, toast:Landroid/widget/Toast;
    const/16 v2, 0x10

    invoke-virtual {v1, v2, v4, v4}, Landroid/widget/Toast;->setGravity(III)V

    .line 196
    invoke-virtual {v1}, Landroid/widget/Toast;->show()V

    .line 198
    .end local v1           #toast:Landroid/widget/Toast;
    :cond_1
    return-void
.end method
